<?php

namespace think\wework\Api;

use think\wework\Abstracts\WeworkApiWithTokenAndCache;

class JsApiTicket extends WeworkApiWithTokenAndCache
{
    /**
     * @return string
     */
    protected function getCacheKey(): string
    {
        $unique = md5($this->corpSecret);

        return md5('wework.api.js_ticket.' . $unique);
    }

    /**
     * @return string
     */
    protected function getFromServer(): string
    {
        $data = $this->httpClient->get('get_jsapi_ticket')->toArray();

        return $data['ticket'];
    }
}
